<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: fuzzy_search.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

if (($_GET['keywords']) && (SEARCH_ACTIVATE_SUGGEST == 'true')){

	$list_data = get_list_data('fuzzy_search');
	require_once(DIR_WS_CLASSES.'class.fuzzy_search.php');

	$keywords = strtolower($_GET['keywords']);

	$Suggest = new FuzzySearch();
	$Suggest->getSuggest($keywords);
	$module_content_keywords = $Suggest->resultKeywords;
	$module_content_products = $Suggest->new_fuzzy;
	$parse_time = $Suggest->parse_time;

	if($module_content_keywords)
		$module_smarty->assign('keyword_data', $module_content_keywords);

	if ($module_content_products) {
		$info_smarty = new Smarty;
		$info_smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
		$info_smarty->assign('language', $_SESSION['language']);
		$info_smarty->assign('module_content', $module_content_products);
        $info_smarty->assign('LIST_NAME', 'fuzzy_search');
		if($list_data['col']>1)
			$info_smarty->assign('CLASS_NAME', 'grid');
		else
			$info_smarty->assign('CLASS_NAME', 'list');
		$info_smarty->caching = false;
		$module_smarty->assign('suggest_products', $info_smarty->fetch(CURRENT_TEMPLATE.'/module/'.$list_data['list_file'].'.html'));
	} 

	if (SEARCH_SHOW_PARSETIME == 'true')
		$module_smarty->assign('PARSE_TIME', '<small>'.$parse_time.' s</small>');
}